
char *capitalizeTitle(char *title)
{
    int j;
    int start = 0;
    while (start < strlen(title))
    {
        if (title[start] != ' ' && start + 1 == strlen(title) || title[start] != ' ' && title[start + 1] != ' ' && start + 2 == strlen(title) || title[start] != ' ' && title[start + 1] != ' ' && title[start + 2] == ' ' || title[start] != ' ' && title[start + 1] == ' ')
        {
            for (j = start; title[j] != ' ' && j < strlen(title); ++j)
            {
                if (title[j] >= 'A' && title[j] <= 'Z')
                {
                    title[j] += 32;
                }
            }
            start = j + 1;
        }
        else
        {
            if (title[start] >= 'a' && title[start] <= 'z')
            {
                title[start++] -= 32;
            }
            else
            {
                start++;
            }
            for (j = start; title[j] != ' ' && j < strlen(title); ++j)
            {
                if (title[j] >= 'A' && title[j] <= 'Z')
                {
                    title[j] += 32;
                }
            }
            start = j + 1;
        }
    }
    return title;
}